﻿<!-- 2017-12-7 14:56:03 | 修改 木遥（微信:  http://marsgis.cn/weixin.html ） -->
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport"
        content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="x5-fullscreen" content="true">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />

    <!-- 标题及搜索关键字 -->
    <meta name="keywords" content="火星科技,cesium,3D,GIS,marsgis,三维,地球,地图,开发,框架,系统,示例,资料,模型,离线,外包,合肥,安徽,中国" />
    <meta name="description"
        content="火星科技 合肥火星 合肥火星科技 合肥火星科技有限公司 leaflet leaflet框架 leaflet开发 cesium cesium开发 cesium框架 三维 地球 模型  gis marsgis 地图离线 地图开发 地图框架 地图外包 框架 开发 外包  地图离线 二维地图 三维地图 全景漫游 地理信息系统 云GIS 三维GIS GIS平台 WebGIS" />

    <link rel="shortcut icon" type="image/x-icon" href="http://cesium.marsgis.cn/favicon.ico">
    <title>动态立体墙 |Mars3D ( MarsGIS for Cesium )|三维地图| 火星科技|合肥火星科技|合肥火星科技有限公司</title>



    <script type="text/javascript" src="../lib/include-lib.js" libpath="../lib/"
        include="jquery,font-awesome,bootstrap,layer,haoutil,turf,mars3d"></script>

    <link href="css/style.css" rel="stylesheet" />
</head>

<body class="dark">
    <!--加载前进行操作提示，优化用户体验-->
    <div id="mask" class="signmask" onclick="removeMask()"></div>

    <div id="cesiumContainer" class="mars3d-container"></div>


    <script type="text/javascript">
        $(document).ready(function () {
            if (!mars3d.util.webglreport()) {
                alert('系统检测到您使用的浏览器不支持WebGL功能');
                layer.open({
                    type: 1,
                    title: "当前浏览器不支持WebGL功能",
                    closeBtn: 0,
                    shadeClose: false,
                    resize: false,
                    area: ['600px', '200px'], //宽高
                    content: '<div style="margin: 20px;"><h3>系统检测到您使用的浏览器不支持WebGL功能！</h3>  <p>1、请您检查浏览器版本，安装使用最新版chrome、火狐或IE11以上浏览器！</p> <p>2、WebGL支持取决于GPU支持，请保证客户端电脑已安装显卡驱动程序！</p></div>'
                });
            }

            initMap();
        });

        function removeMask() {
            $("#mask").remove();
        }


        var viewer;
        //初始化地图
        function initMap() {
            //url传参，一个系统动态使用不同配置
            var configfile = haoutil.system.getRequestByName("config", "config/config.json");

            mars3d.createMap({
                id: 'cesiumContainer',
                url: configfile,
                center: { "y": 31.735621, "x": 117.155931, "z": 11700.82, "heading": 5.9, "pitch": -50.9, "roll": 0 },
                success: function (_viewer, jsondata) {//地图成功加载完成后执行
                    viewer = _viewer;

                    setTimeout(removeMask, 3000);
                    initWork();
                }
            });
        }



        //当前页面业务相关
        function initWork() {

            var dataSource = new Cesium.CustomDataSource();
            viewer.dataSources.add(dataSource);


            //显示合肥市边界
            $.getJSON(serverURL_file + "/geojson/hefei.json", function (result) {
                addBoundary(result);
            });


            //示例 
            dataSource.entities.add({
                name: '动态立体墙1',
                wall: {
                    positions: Cesium.Cartesian3.fromDegreesArray([
                        117.154815, 31.853495,
                        117.181255, 31.854257,
                        117.182284, 31.848255,
                        117.184748, 31.840141,
                        117.180557, 31.835556,
                        117.180023, 31.833741,
                        117.166846, 31.833737,
                        117.155531, 31.833151,
                        117.154787, 31.835978,
                        117.151994, 31.839036,
                        117.150691, 31.8416,
                        117.151215, 31.844734,
                        117.154788, 31.853486
                    ]),
                    maximumHeights: [600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600],
                    minimumHeights: [43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43],
                    material: new mars3d.LineFlowMaterial({//动画线材质
                        color: Cesium.Color.fromCssColorString("#00ff00"),
                        duration: 2000, //时长，控制速度
                        url: 'img/textures/fence.png',
                        axisY: true
                    }),
                }
            });

            //示例 
            dataSource.entities.add({
                name: '动态箭头立体墙',
                wall: {
                    positions: Cesium.Cartesian3.fromDegreesArray([
                        117.216321, 31.842863,
                        117.246056, 31.843395,
                        117.246503, 31.818713,
                        117.217114, 31.819745,
                        117.216566, 31.842705
                    ]),
                    maximumHeights: [500, 500, 500, 500, 500],
                    minimumHeights: [38, 44, 34, 34, 38],
                    material: new mars3d.LineFlowMaterial({//动画线材质
                        color: Cesium.Color.CHARTREUSE,
                        duration: 1000, //时长，控制速度
                        url: 'img/textures/arrow.png',
                        repeat: new Cesium.Cartesian2(30, 1),
                    }),
                }
            });

            //示例 
            dataSource.entities.add({
                name: '红色感叹号墙',
                wall: {
                    positions: Cesium.Cartesian3.fromDegreesArray([
                        117.191537,
                        31.809769,
                        117.198383,
                        31.804991
                    ]),
                    maximumHeights: [500, 500],
                    minimumHeights: [41.14, 39.84],
                    material: new mars3d.LineFlowMaterial({//动画线材质
                        color: Cesium.Color.fromCssColorString("#ff0000"),
                        duration: 2000, //时长，控制速度
                        url: 'img/textures/fence.png',
                        axisY: true,
                        bgUrl: 'img/textures/tanhao.png',
                        bgColor: Cesium.Color.fromCssColorString("#FFFF00"),
                    }),
                }
            });

            //显示【贴地线】的箭头效果
            var flowMaterial = new mars3d.GroundLineFlowMaterial({
                image: './img/textures/arrow2.png',
                axisY: false,
                speed: 5,
                repeat: { x: 20, y: 1 },
                color: Cesium.Color.GREENYELLOW
            });
            var instance = new Cesium.GeometryInstance({
                geometry: new Cesium.GroundPolylineGeometry({
                    positions: Cesium.Cartesian3.fromDegreesArray([
                        117.169646, 31.769171,
                        117.194579, 31.806466,
                    ]),
                    width: 20
                }),
                id: 'GroundPolylineGeometry'
            });
            viewer.scene.groundPrimitives.add(new Cesium.GroundPolylinePrimitive({
                geometryInstances: instance,
                appearance: new Cesium.Appearance({
                    material: flowMaterial,
                    renderState: new Cesium.RenderState()
                })
            }));





            //显示线的箭头效果
            var redLine = dataSource.entities.add({
                name: '箭头线',
                polyline: {
                    positions: Cesium.Cartesian3.fromDegreesArrayHeights([
                        117.204289, 31.763824, 32.05,
                        117.228083, 31.791911, 41.73,
                    ]),
                    width: 20,
                    material: new mars3d.LineFlowMaterial({//动画线材质
                        color: Cesium.Color.AQUA,
                        duration: 1000, //时长，控制速度
                        url: './img/textures/arrow2.png',
                        repeat: new Cesium.Cartesian2(10, 1),
                    }),
                }
            });


            //走马灯围墙效果
            var positions = mars3d.pointconvert.lonlats2cartesians([
                [117.13949, 31.822909, 38.43],
                [117.148559, 31.822854, 35.56],
                [117.151724, 31.822788, 41.61],
                [117.161761, 31.816883, 42.53],
                [117.152841, 31.805183, 40.7],
                [117.139295, 31.805423, 26.78]
            ]);
            var scrollWallGlow = new mars3d.ScrollWallGlow(viewer, {
                positions: positions,
                color: Cesium.Color.fromCssColorString("#f2fa19"), 
                height: 500,    //高度
                direction: 1,   //方向：1往上、-1往下
                speed: 100
            });


            //走马灯围墙效果2
            var positions = mars3d.pointconvert.lonlats2cartesians([
                [117.096979, 31.822785, 34.6],
                [117.119188, 31.822947, 38.36],
                [117.119354, 31.805121, 31.04],
                [117.096974, 31.805181, 29.64]
            ]);
            var scrollWallGlow = new mars3d.ScrollWallGlow(viewer, {
                positions: positions,
                color: Cesium.Color.fromCssColorString("#f33349"), 
                height: 500,    //高度
                direction: 1,   //方向：1往上、-1往下
                speed: 200,
                style: 2
            });







        }



        //加单个墙和名称
        function addBoundary(feature) {
            var coordinates = feature.geometry.coordinates[0];
            var height = 3000;

            var positions = [];
            var minimumHeights = [];
            var maximumHeights = [];
            for (var i = 0, len = coordinates.length; i < len; i++) {
                positions.push(
                    Cesium.Cartesian3.fromDegrees(coordinates[i][0], coordinates[i][1])
                );
                maximumHeights.push(height);
                minimumHeights.push(0);
            }

            viewer.entities.add({
                name: "行政区划立体",
                wall: {
                    positions: positions,
                    maximumHeights: maximumHeights,
                    minimumHeights: minimumHeights,
                    material: new mars3d.LineFlowMaterial({
                        //动画线材质
                        color: Cesium.Color.fromCssColorString("#0111A9"),
                        duration: 3000, //时长，控制速度
                        url: "img/textures/fence.png",
                        repeat: new Cesium.Cartesian2(5, 1),
                        axisY: false
                    }),
                },
            });


        }

    </script>
</body>

</html>